//
//  userThirdTableViewCell.m
//  lmq
//
//  Created by 千翼网络科技 on 2017/1/17.
//  Copyright © 2017年 yuanxin. All rights reserved.
//

#import "userThirdTableViewCell.h"
#import "shareViewController.h"
#import "balanceViewController.h"
#import "cashViewController.h"
#import "teamViewController.h"
#import "MyFansViewController.h"
#import "EditMyBankCardViewController.h"



@implementation userThirdTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backView=[[UIView alloc]initWithFrame:CGRectMake(0,  0, DEF_SCREEN_WIDTH, (125))];
        self.backView.backgroundColor=[UIColor whiteColor];
        [self addSubview:self.backView];
        
        //我是分享达人
        self.orderButton=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, DEF_SCREEN_WIDTH, (44))];
        [self.orderButton addTarget:self action:@selector(orderButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self.backView addSubview:self.orderButton];
        UILabel *orderLabel=[[UILabel alloc]initWithFrame:CGRectMake((10), (14), (120), (16))];
        orderLabel.text=@"我是分享达人";
        orderLabel.textAlignment=NSTextAlignmentLeft;
        orderLabel.textColor=[ZJCModel colorWithString:@"222222"];
        [self.orderButton addSubview:orderLabel];
        UILabel *allLabel=[[UILabel alloc]initWithFrame:CGRectMake(DEF_SCREEN_WIDTH-(110), (15), (100), (14))];
        allLabel.text=@"推广二维码";
        allLabel.textColor=[ZJCModel colorWithString:@"666666"];
        [self.orderButton addSubview:allLabel];
        UIImageView *youImageView=[[UIImageView alloc]initWithFrame:CGRectMake(DEF_SCREEN_WIDTH-(20), (15), (14), (14))];
        youImageView.image=[UIImage imageNamed:@"next"];
        [self.orderButton addSubview:youImageView];
        
        //线
        self.xianView=[[UIView alloc]initWithFrame:CGRectMake((10), (44), DEF_SCREEN_WIDTH-(20), (1))];
        self.xianView.backgroundColor=[ZJCModel colorWithString:@"f2f2f2"];
        [self.backView addSubview:self.xianView];
        
        //余额
        self.dfkButton=[[UIButton alloc]initWithFrame:CGRectMake((30), (45+11),(DEF_SCREEN_WIDTH-(30*6))/5 , (53))];
        [self.dfkButton addTarget:self action:@selector(dfkButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self.backView addSubview:self.dfkButton];
        
        self.dfkLabel1=[[UILabel alloc]initWithFrame:CGRectMake((5), (2), (50), (30))];
        self.dfkLabel1.text=@"10元";
        self.dfkLabel1.textAlignment=NSTextAlignmentLeft;
        self.dfkLabel1.font=[UIFont systemFontOfSize:(12)];
        [self.dfkButton addSubview:self.dfkLabel1];
        
        UILabel *dfkLabel=[[UILabel alloc]initWithFrame:CGRectMake((2), (32+3), (DEF_SCREEN_WIDTH-(20*6))/5, (20))];
        dfkLabel.text=@"余额";
        dfkLabel.font=[UIFont systemFontOfSize:(12)];
        [self.dfkButton addSubview:dfkLabel];
        
        //积分
        self.dfhButton=[[UIButton alloc]initWithFrame:CGRectMake((60+(DEF_SCREEN_WIDTH-(30*6))/5), (45+11),(DEF_SCREEN_WIDTH-(30*6))/5 , (53))];
        [self.dfhButton addTarget:self action:@selector(dfhButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self.backView addSubview:self.dfhButton];
        
        self.dfkLabel2=[[UILabel alloc]initWithFrame:CGRectMake((5), (2), (50), (30))];
        self.dfkLabel2. text=@"100";
        self.dfkLabel2.textAlignment=NSTextAlignmentLeft;
        self.dfkLabel2.font=[UIFont systemFontOfSize:(12)];
        [self.dfhButton addSubview:self.dfkLabel2];
        
        UILabel *dfhLabel=[[UILabel alloc]initWithFrame:CGRectMake((2), (32+3), (DEF_SCREEN_WIDTH-(20*6))/5, (20))];
        dfhLabel.text=@"积分";
        dfhLabel.font=[UIFont systemFontOfSize:(12)];
        [self.dfhButton addSubview:dfhLabel];
        
        //团队
        self.dshButton=[[UIButton alloc]initWithFrame:CGRectMake((90+(DEF_SCREEN_WIDTH-(30*6))/5*2), (45+11),(DEF_SCREEN_WIDTH-(30*6))/5 , (53))];
        [self.dshButton addTarget:self action:@selector(dshButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self.backView addSubview:self.dshButton];
        
        self.dfkLabel3=[[UILabel alloc]initWithFrame:CGRectMake((10), (2), (50), (30))];
        self.dfkLabel3.text=@"33人";
//        self.dfkLabel3.textAlignment= NSTextAlignmentCenter;
        self.dfkLabel3.font=[UIFont systemFontOfSize:(12)];
        [self.dshButton addSubview:self.dfkLabel3];
        
        UILabel *dshLabel=[[UILabel alloc]initWithFrame:CGRectMake((2), (32+3), (DEF_SCREEN_WIDTH-(20*6))/5, (20))];
        dshLabel.text=@"团队";
        dshLabel.textAlignment = NSTextAlignmentLeft;
        dshLabel.font=[UIFont systemFontOfSize:(12)];
        [self.dshButton addSubview:dshLabel];
        
        //销售额
        self.jycgButton=[[UIButton alloc]initWithFrame:CGRectMake((120+(DEF_SCREEN_WIDTH-(30*6))/5*3), (45+11),(DEF_SCREEN_WIDTH-(30*6))/5 , (53))];
        //        [self.jycgButton addTarget:self action:@selector(jycgButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self.backView addSubview:self.jycgButton];
        
        self.dfkLabel4=[[UILabel alloc]initWithFrame:CGRectMake((-10), (2), (50), (30))];
        self.dfkLabel4.text=@"100.33元";
        self.dfkLabel4.textAlignment=NSTextAlignmentCenter;
        self.dfkLabel4.font=[UIFont systemFontOfSize:(12)];
        [self.jycgButton addSubview:self.dfkLabel4];
        
        UILabel *jycgLabel=[[UILabel alloc]initWithFrame:CGRectMake((-5), (32+3), (DEF_SCREEN_WIDTH-(20*6))/3, (20))];
        jycgLabel.text=@"销售额";
        jycgLabel.font=[UIFont systemFontOfSize:(12)];
        [self.jycgButton addSubview:jycgLabel];
        
        //提现
        self.tkthButton=[[UIButton alloc]initWithFrame:CGRectMake((150+(DEF_SCREEN_WIDTH-(30*6))/5*4), (45+11),(DEF_SCREEN_WIDTH-(30*6))/5 , (53))];
        [self.tkthButton addTarget:self action:@selector(tkthButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self.backView addSubview:self.tkthButton];
        
        UIImageView *tkthImageView=[[UIImageView alloc]initWithFrame:CGRectMake((4), (2), (30), (30))];
        tkthImageView.image=[UIImage imageNamed:@"yuedatu"];
        [self.tkthButton addSubview:tkthImageView];
        
        UILabel *tkthLabel=[[UILabel alloc]initWithFrame:CGRectMake((-5), (32+3), (DEF_SCREEN_WIDTH-(20*6))/5, (20))];
        tkthLabel.text=@"   提现";
        tkthLabel.textAlignment=NSTextAlignmentLeft;
        tkthLabel.font=[UIFont systemFontOfSize:(12)];
        [self.tkthButton addSubview:tkthLabel];
        
        //xianer
        self.xianView=[[UIView alloc]initWithFrame:CGRectMake(0, (120), DEF_SCREEN_WIDTH, (5))];
        self.xianView.backgroundColor=[ZJCModel colorWithString:@"f2f2f2"];
        [self.backView addSubview:self.xianView];
        
    }
    return self;
}

-(void)dfkButtonClick{
    balanceViewController *balanceVC=[[balanceViewController alloc]init];
    balanceVC.hidesBottomBarWhenPushed=YES;
    [((userViewController *)self.thirdViewController).navigationController pushViewController:balanceVC animated:YES];
}

-(void)dfhButtonClick{
   
}

-(void)dshButtonClick{
    NSLog(@"团队我的粉丝");
    MyFansViewController *fansVC = [[MyFansViewController alloc] init];
    fansVC.hidesBottomBarWhenPushed = YES;
    
     [((userViewController *)self.thirdViewController).navigationController pushViewController:fansVC animated:YES];
    
}

//-(void)jycgButtonClick{
//    teamViewController *teamVC=[[teamViewController alloc]init];
//    teamVC.hidesBottomBarWhenPushed=YES;
//    [((userViewController *)self.thirdViewController).navigationController pushViewController:teamVC animated:YES];
//}

-(void)tkthButtonClick{
    
    
    NSMutableDictionary *productParams=[[NSMutableDictionary alloc]init];
    NSString *tokenStr=[PublicFunction getConfigWithKey:@"token"];
    [productParams setValue:tokenStr forKey:@"token"];
    [[MNetworkHandler sharedInstance]conURL:My_WithdrawalsIndex
                                networkType:NetWorkPOST
                                     params:productParams
                                   delegate:nil
                                    showHUD:NO
                               successBlock:^(id returnData) {
                                   if ([[returnData objectForKey:@"code"]intValue]==1) {
                                       
                                       cashViewController *cashVC=[[cashViewController alloc]init];
                                       cashVC.hidesBottomBarWhenPushed=YES;
                                       [((userViewController *)self.thirdViewController).navigationController pushViewController:cashVC animated:YES];
                   
                                       
                                   }
                                   else {
                                       
                                       
                                       EditMyBankCardViewController *vc = [[EditMyBankCardViewController alloc] init];
                                       vc.hidesBottomBarWhenPushed = YES;
                                        [((userViewController *)self.thirdViewController).navigationController pushViewController:vc animated:YES];
                                       
                                       [PublicFunction showAlert:nil message:[returnData objectForKey:@"msg"] duration:5.0f];
                                   }
                               } failureBlock:^(NSError *error) {
                                   NSLog(@"%@",error);
                                   [PublicFunction showAlert:nil message:@"没有连接网络" duration:10.0f];
                               }];
    

    
    
    
}

-(void)orderButtonClick{
    shareViewController *shareVC=[[shareViewController alloc]init];
    shareVC.hidesBottomBarWhenPushed= YES;
    [((userViewController *)self.thirdViewController).navigationController pushViewController:shareVC animated:YES];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
